<?php
/**
 * @Copyright   2008, XXXX-XXXX
 * All rights reserved. 
 * feature summary.
 * @filesource  FriendListCommand.php 
 * @author      lipeng <lipengage@gmain.com> 
 * @package     / 
 * @version     $Id: $ 
 */

class FriendListCommand extends command{
	public function excute() {
		$userdb = new user_dao();
		$activitydb = new activity_dao();
		
		$viewerid = $this->request['vid'];
		$container = $this->request['ctn'];
		$friends = $this->request['friends'];
		
		if (empty($viewerid) || empty($container)) {
			$this->set_messageid(command::$PARAM_ERROR);
			return true;
		}
		
		$viewer = $userdb->user_get_byid($container, $viewerid);
		if ($viewer["count"] < 1) {
			$this->set_messageid(command::$PLAYER_NOT_FOUND);
			return true;
		}

		$friends_list = $userdb->user_get_byids($container, $friends);

		if ($friends_list["count"] < 1) {
			$this->set_messageid(command::$PLAYER_NOT_FOUND);
			return true;
		}
		else {
			$this->set_haserror(false);
			$params = array();
			foreach($friends_list["result"] as $v) {
				$v["userId"] = $v["uid"];
				$this->set_data($v["uid"], $v);
			}
			
		}
		return false;
	}
}
?>